package com.oracle.moudle;


import com.oracle.common.TemplateMoudleMethod;
import com.oracle.service.IGirlService;

import com.oracle.vo.Boy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @program: CampusMatching
 * @description:
 * @author: zhaolei
 * @create: 2020-07-25 16:49
 **/
@Component
public class TemplateMoudleimp  extends TemplateMoudleMethod {

    @Autowired
    IGirlService iGirlService;

    private static TemplateMoudleimp  templateMoudleimp ;

    @PostConstruct //通过@PostConstruct实现初始化bean之前进行的操作
    public void init() {
        templateMoudleimp  = this;
        templateMoudleimp .iGirlService = this.iGirlService;
        // 初使化时将已静态化的templateMoudleimp实例化
    }

    private Boy boy;


    public TemplateMoudleimp(Boy boy) {
        this.boy = boy;
    }

    @Override
    public Boolean getObjByHobby() {
        System.out.println("根据爱好匹配");
        super.list=templateMoudleimp.iGirlService.getGirlByHobby(this.boy.getBhobby());
        if(!super.list.isEmpty()){
            return true;
        }else {
        return false;}
    }

    @Override
    public Boolean getObjBySchool() {
        System.out.println("根据学校匹配");
        super.list=templateMoudleimp.iGirlService.getGirlBySchool(this.boy.getBschool());
        if(!super.list.isEmpty()){
            return true;
        }else {
            return false;}
    }

    @Override
    public Boolean getObjByBirthday() {
        System.out.println("根据生日匹配");
        super.list=templateMoudleimp.iGirlService.getGirlByBirthday(this.boy.getBbirthday());
        if(!super.list.isEmpty()){
            return true;
        }else {
            return false;}
    }

    @Override
    public Boolean getObjByself() {
        System.out.println("获取指定刘亦菲");
        super.list=templateMoudleimp.iGirlService.getLyf();
        if(!super.list.isEmpty()){
            return true;
        }else {
            return false;}
}
}
